<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String score = request.getParameter("score");
String type = request.getParameter("type");
%>
<!DOCTYPE>
<html>
<head>
<!-- 职业测评结果 -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../../bootstrap-table/bootstrap.min.css" />
<link rel="stylesheet" href="../../bootstrap-table/bootstrap-table.css">
<link rel="stylesheet" href="../../font-awesome-4.6.3/css/font-awesome.min.css" />
<link rel="stylesheet" href="../../css/window.css" />
<link rel="stylesheet" href="../../css/top.css" />
<link rel="stylesheet" href="../../css/home.css" />
<script src="../../js/jquery.min.js"></script>
<script src="../../js/window.js"></script>
<script src="../../js/offer_dialog.js"></script>
<script src="../../bootstrap-table/bootstrap-table.js"></script>
<script src="../../bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
<style>
   table.my_table thead tr {
    background: #6f97c7 none repeat scroll 0 0;
    color: white;
}
</style>
<title>智行校园-精准化服务平台</title>
</head>
<body class="background">
  <input type="hidden" value="职业测评"  />
  <div class="container">
     <h3>职业测试结果分析</h3>
     <div class="test_conclusion1">
       <h3 class="h3-style">MBTI图形分析</h3>
       <main>
        <p class="p-style_1">外向<span ><input /></span></p>
        <p class="p-style_2"><span ><input /></span>内向</p>
        <p class="p-style_3">实感<span ><input /></span></p>
        <p class="p-style_4"><span ><input   /></span>直觉</p>
        <p class="p-style_5">思考<span ><input /></span></p>
        <p class="p-style_6"><span ><input /></span>情感</p>
        <p class="p-style_7">判断<span ><input  /></span></p>
        <p class="p-style_8"><span ><input  /></span>知觉</p>
      </main>
     </div>
     <div class="test_conclusion2"> 
      <h3>总结：</h3>
     </div>
     <div class="test_conclusion3">
       <h3>推荐职业及实现建议：</h3>
       <table class="my_table" cellspacing="0" cellpadding="0">
         <thead>
            <tr>
               <td>所属行业</td>
               <td>职业推荐</td>
               <td>具体岗位推荐</td>
            </tr>
         </thead>
		 <tbody></tbody>
       </table>
     </div>
  </div>
  <div id="table_dialog" style="display:none;" class="table_dialog"></div>
  <form method="post"  name="userid_form" >
	    <input type="hidden" value="" name="userid" />
  </form>
  <script>
	var user_id = '<%=session.getAttribute("userid")%>';
	var user_name = '<%=session.getAttribute("username")%>';
	var faceaddress = '<%=session.getAttribute("faceaddress")%>';
	var ticket = '<%=session.getAttribute("ticket")%>';
	//测试结果
	var type="<%=type%>";
	var score = [<%=score%>];
	   $('body').append(' <input id="user_id" style="display:none" value="'+user_id+'"  />');
	   $('form[name="userid_form"] input[name="userid"]').attr('value',user_id);
	   </script>
	   <script src="../../js/top.js"></script>
<script>

  $(function(){
	   for(var i=0;i<score.length;i++){
		   $('div.test_conclusion1 p.p-style_'+(i+1)+'>span>input').css('width',score[i]/6*100+'%');
	   }
	   $.getJSON('/WDDXSERVER/professionalAssessment/getPostList',{userid:user_id,post:type,ticket:ticket},function(data){
				   var job_list='';
				   $('div.test_conclusion1 ').prepend('<h3>结论 ：'+type+'--'+data.describe+'</h3>');
				   $('div.test_conclusion2 ').append('<p>'+data.character+'</p>');
				   for(var b=0;b<data.advice.length;b++) {
					   for(var p=0;p<data.advice[b].profession.length;p++){
						   if(p==0){
							   job_list+='<tr><th rowspan="'+data.advice[b].profession.length+'">'+data.advice[b].industry+'</th>'+
								        '<td data-id="'+ data.advice[b].profession[p].profession_id+'">'+
							                 data.advice[b].profession[p].profession_name+'</td><td>';
						               for(var c=0;c<data.advice[b].profession[p].job.length;c++)
							             job_list+='<a href="#" data-id="'+data.advice[b].profession[p].job[c].job_id+'">'+
							                  data.advice[b].profession[p].job[c].job_name+'；</a>';
							 }
						   else
							   {
							   job_list+='<tr><td data-id="'+data.advice[b].profession[p].profession_id+'">'
							         +data.advice[b].profession[p].profession_name+'</td><td>';
							   for(var c=0;c<data.advice[b].profession[p].job.length;c++)
								     job_list+='<a href="#" data-id="'+data.advice[b].profession[p].job[c].job_id+'">'+
								        data.advice[b].profession[p].job[c].job_name+'；</a>';
							   }
						   job_list+='</td></tr>';
						  
					   }
				   }
				   $('div.test_conclusion3 table.my_table tbody').append(job_list);
		   $('div.test_conclusion3 tbody a').click(function(event){
			   var top=document.documentElement.scrollTop || document.body.scrollTop;
			   var user_name=$('div.header_tright a:eq(2)').text();
			   offer_dialog($(this).attr('data-id'),'table_dialog',$('div.header_tright img').attr('src'),user_id,user_name,event.clientY+top);
			   return false;
		   })
	   });
  });
  </script>
</body>
</html>